﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Article_priview_json.aspx.cs" Inherits="newBlog.CenterInc.view_json.admin.Article_priview_json" %>
<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<% 
    Response.ContentType = "application/json";
    if (Session["user_id"]==null) {
        Response.Write("{\"error\":\"您未登录本站\"}");
        return;
    }
    if (Convert.ToInt32(Session["user_grade"])!=1) { 
    Response.Write("{\"error\":\"您不是管理员\"}");
        return;
    }
    
    int page = Request.Form["page"]==null?0:(Convert.ToInt32(Request.Form["page"])-1)*20;
    string maxPrice = Request.Form["maxPrice"]==null||Request.Form["maxPrice"].Length==0?"":Request.Form["maxPrice"];
    string minPrice = Request.Form["minPrice"]==null||Request.Form["minPrice"].Length==0?"":Request.Form["minPrice"];
    string minTime = Request.Form["minTime"] == null||Request.Form["minTime"].Length==0? "":Request.Form["minTime"];
    string maxTime = Request.Form["maxTime"] == null||Request.Form["maxTime"].Length==0? "":Request.Form["maxTime"];
    string catalog = Request.Form["catalog"] == null||Request.Form["catalog"].Length==0? "":Request.Form["catalog"];
    string user_id = Request.Form["user_id"]==null||Request.Form["user_id"].Length==0?"%%":"%"+Request.Form["user_id"]+"%";
    string title = Request.Form["search"] == null||Request.Form["search"].Length==0? "" : Request.Form["search"];
     JavaScriptSerializer serializer = new JavaScriptSerializer();
    Article_inc article_Inc = new Article_inc();
    List<MyArticle_itemDao_json> list = article_Inc.myArticle_ItemDao_Jsons(user_id,page,minPrice,maxPrice,minTime,maxTime,catalog,title);
    int count = article_Inc.MyarticleCount(user_id,minPrice,maxPrice,minTime,maxTime,catalog,title);
    string json = "{\"code\":0,\"msg\":\"\",\"count\":"+count+",\"data\":"+serializer.Serialize(list)+"}";
    Response.Write(json);
    %>